package com.ruanyun.tio.net.server.utils;

import com.ruanyun.tio.net.common.Const;
import com.ruanyun.tio.net.common.SessionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tio.core.ChannelContext;

/**
 * @author tanyaowu 
 * 2018年5月28日 下午10:35:12
 */
public class Utils {
	@SuppressWarnings("unused")
	private static Logger log = LoggerFactory.getLogger(Utils.class);

	/**
	 * @author tanyaowu
	 */
	public Utils() {
	}

	/**
	 * 
	 * @param channelContext
	 */
	public static void setSharebikeSessionContext(ChannelContext channelContext) {
		SessionContext sharebikeSessionContext = new SessionContext();
		channelContext.setAttribute(Const.SHAREBIKE_SESSION_KEY, sharebikeSessionContext);
	}
	
	/**
	 * 
	 * @param channelContext
	 * @return
	 */
	public static SessionContext getSharebikeSessionContext(ChannelContext channelContext) {
		return (SessionContext)channelContext.getAttribute(Const.SHAREBIKE_SESSION_KEY);
	}
	
	
	
}
